package com.dawn.idolmanage.dao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;

import com.dawn.idolmanage.bean.IdolInfoBean;

@Repository
public class IdolManageDao {

    @Autowired
    private HibernateTemplate hibernateTemplate;

    public List<IdolInfoBean> findUser(Long userId, String idolId) {
        @SuppressWarnings("unchecked")
        List<IdolInfoBean> users = (List<IdolInfoBean>) hibernateTemplate.find(
                "from IdolInfoBean u where u.userId = ? and u.idolId = ?", userId, idolId);
        return users;
    }

    public void addIdolInfo(IdolInfoBean idolInfo) {
        hibernateTemplate.save(idolInfo);
    }

}
